home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
machack
/
Hacks97
/
WarriorsProgress.sit
/
Warrior’s Progress
/
source code
/
Source
/
Libraries
/
Drawing
/
RegionObject.h
< prev
next >
Wrap
Text File
|
1997-06-28
|
3KB
|
81 lines
// RegionObject.h
#ifndef RegionObject_h
#define RegionObject_h
#ifndef Rectangle_h
#include "Rectangle.h"
#endif
class RegionObject
{
private:
RgnHandle me;
static RegionObject& Temporary( const Rect& );
static RegionObject& Temporary( RgnHandle );
public:
RegionObject();
RegionObject( RgnHandle );
RegionObject( const RegionObject& );
RegionObject( const Rect& );
~RegionObject() { DisposeRgn( me ); }
void BeEmpty() { SetEmptyRgn( me ); }
void operator=( const Rect& r ) { RectRgn( me, &r ); }
void operator=( RgnHandle r ) { CopyRgn( r, me ); }
void operator=( const RegionObject& r ) { CopyRgn( r, me ); }
void operator&=( const Rect& r );
void operator|=( const Rect& r );
void operator^=( const Rect& r );
void operator-=( const Rect& r );
void Complement( const Rect& r );
void operator&=( RgnHandle r ) { SectRgn( me, r, me ); }
void operator|=( RgnHandle r ) { UnionRgn( me, r, me ); }
void operator^=( RgnHandle r ) { XorRgn( me, r, me ); }
void operator-=( RgnHandle r ) { DiffRgn( me, r, me ); }
void Complement( RgnHandle r ) { DiffRgn( r, me, me ); }
void operator+=( Point vector ) { OffsetRgn( me, vector.h, vector.v ); }
void operator-=( Point vector ) { OffsetRgn( me, -vector.h, -vector.v ); }
void Inset( int16 amount ) { InsetRgn( me, amount, amount ); }
void Inset( Point amount ) { InsetRgn( me, amount.h, amount.v ); }
void Outset( int16 amount ) { InsetRgn( me, -amount, -amount ); }
void Outset( Point amount ) { InsetRgn( me, -amount.h, -amount.v ); }
void GlobalToLocal();
void LocalToGlobal();
Rectangle Bounds() const { return (*me)->rgnBBox; }
operator RgnHandle() const { return me; }
bool IsEmpty() const { return EmptyRgn( me ); }
bool Contains( Point p ) const { return PtInRgn( p, me ); }
bool Rectangular() const { return (*me)->rgnSize == 10; }
bool Intersects( const Rect& r ) const;
bool Intersects( const RgnHandle r ) const;
bool operator==( const Rect& r ) const;
bool operator!=( const Rect& r ) const { return !(*this == r); }
bool operator<=( const Rect& r ) const;
bool operator>=( const Rect& r ) const;
bool operator<( const Rect& r ) const { return *this <= r && *this != r; }
bool operator>( const Rect& r ) const { return *this >= r && *this != r; }
bool operator==( RgnHandle r ) const { return EqualRgn( me, r ); }
bool operator!=( RgnHandle r ) const { return !EqualRgn( me, r ); }
bool operator<=( RgnHandle r ) const;
bool operator>=( RgnHandle r ) const;
bool operator<( RgnHandle r ) const { return *this <= r && *this != r; }
bool operator>( RgnHandle r ) const { return *this >= r && *this != r; }
};
#endif